﻿using Company.Application.Main.Views;
using Company.Application.Share.Prism;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Company.Application.Main
{
    public class ApplicationMainModule : IModule
    {

        /// <summary>
        /// 加载（初始化）
        /// </summary>
        /// <param name="containerProvider"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void OnInitialized(IContainerProvider containerProvider)
        {
            //将IOC中的MainView导航到名为MainRegion的区域中
            containerProvider.Resolve<IRegionManager>().RegisterViewWithRegion<MainView>(RegionNames.MainRegion);
        }

        /// <summary>
        /// 注册(先注册，后初始化)
        /// </summary>
        /// <param name="containerRegistry"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            //先将属于Company.Application.Main模块中的MainView注册到Prism框架中
            containerRegistry.RegisterForNavigation<MainView>();
        }
    }
}
